package com.ahu.Repository;

import com.ahu.domain.RepairCur;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 *
 * @author qx
 * @date 2017/12/3
 */
public interface RepairCurRepository extends JpaRepository<RepairCur, Integer> {
    RepairCur findByNumber(String number);
    List<RepairCur> findAllByRepairStatus(String repairStatus);
    List<RepairCur> findAllByNumber(String number);
    RepairCur findByIdAndRepairOrderNumber(Integer id, String repairOrderNumber);

    @Modifying
    @Query("update RepairCur repairCur set repairCur.repairStatus = :repairStatus where repairCur.number = :number")
    Integer updateStatusByNumber(@Param("repairStatus") String repairStatus, @Param("number") String number);
}
